@extends('home.layout.index')
@section('content')

<div class="i_bg">
	<div class="postion">
    	
    </div>    
    <div class="content">
    	                    
        <div id="tsShopContainer">
            <div id="tsImgS"><a href="/{{$data['pic']}}" title="Images" class="MagicZoom" id="MagicZoom"><img src="/{{$data['pic']}}" width="390" height="390" /></a></div>
            <div id="tsPicContainer">
                
                
            </div>
            <img class="MagicZoomLoading" width="16" height="16" src="/{{$data['pic']}}" alt="Loading..." />				
        </div>
        
        <div class="pro_des">
        	<div class="des_name">
            	<p>{{$data['title']}}</p>
                卖家名称: <b>{{$data['uid']}}</b>
            </div>
            <div class="des_price">
            	<input type="hidden" name="id" value="{{$data['id']}}" id="gid">
            	商品原价：<b>￥{{$data['price']}}</b><br />
                商品现价：<b>￥{{$data['reprice']}}</b><br/>
                商品成色: <b>{{$data['condition']}}</b><br/>
                商品库存: <b id="abcd">{{$data['num']}}</b>
            </div>
            
            
            <div class="des_share">
            	<div class="d_sh">
                	分享
                    <div class="d_sh_bg">
                    	<a href="#"><img src="/home/juse/images/sh_1.gif" /></a>
                        <a href="#"><img src="/home/juse/images/sh_2.gif" /></a>
                        <a href="#"><img src="/home/juse/images/sh_3.gif" /></a>
                        <a href="#"><img src="/home/juse/images/sh_4.gif" /></a>
                        <a href="#"><img src="/home/juse/images/sh_5.gif" /></a>
                    </div>
                </div>
                <div class="d_care"><a onclick="ShowDiv('MyDiv','fade')">关注商品</a></div>
            </div>
            <div class="des_join">
            	<div class="j_nums">
                	<input type="text" value="1" name="" class="n_ipt" />
                    <input type="button" value="" onclick="addUpdate(jq(this));" class="n_btn_1" />
                    <input type="button" value="" onclick="jianUpdate(jq(this));" class="n_btn_2" />   
                </div>
                <span class="fl"><button id="cbtn" class="s_btn" style="height:43px;width:150px;">购　买</button></span>
            </div>            
        </div>    
        
            
        
        
    </div>
    <div class="content mar_20">
    	
        <div class="l_list">        	
            <div class="des_border" id="p_details">
                <div class="des_t">商品详情</div>
                <div class="des_con">
                	<table border="0" align="center" style="width:745px; font-size:14px; font-family:'宋体';" cellspacing="0" cellpadding="0">
                      <tr>
                        <td>
                        	<b>{{$data['intro']}}</b>
                        </td>
                      </tr>
                    </table>
                    
                    
                    
                </div>
          	</div>  
            
            <div class="des_border" id="p_comment">
            	<div class="des_t">商品留言</div>
			
                <table border="0" class="jud_list" style="width:100%; margin-top:30px;" cellspacing="0" cellpadding="0">
                  @foreach($comment as $k=>$v)
                  <tr valign="top">
                    <td width="160"><img src="{{url($v['photo'])}}" width="20" height="20" align="absmiddle" />&nbsp;{{$v['username']}}</td>
                    <td>
                    	{{$v['content']}} <br />
                        <font color="#999999">{{$v['time']}}</font>
                    </td>
                  </tr>
                  @endforeach
                </table>
                    
                 <table border="0" class="jud_list" style="width:100%; margin-top:30px;" cellspacing="0" cellpadding="0">
                  <form action="/goods/reply" method="post">
                    {{csrf_field()}}
                      
                      <input type="hidden" name="gid" value="{{$data['id']}}">
                      <textarea name="reply" id="" cols="150" rows="10" value=""></textarea><br><br>
                      
                      <input type="submit" value="提交" style="width:100px">
                  </form>
                </table>

                	
                    
                <div class="pages">
                    <a href="#" class="p_pre">上一页</a><a href="#" class="cur">1</a><a href="#">2</a><a href="#">3</a>...<a href="#">20</a><a href="#" class="p_pre">下一页</a>
                </div>
                
          	</div>
            
            
        </div>
    </div>
    
    
    <!--Begin 弹出层-收藏成功 Begin-->
    <div id="fade" class="black_overlay"></div>
       
    <!--End 弹出层-收藏成功 End-->
    
    
    <!--Begin 弹出层-加入购物车 Begin-->
    
<script src="/home/juse/js/ShopShow.js"></script>
<script src="/layer/layer.js" ></script>
<script>
	$('#cbtn').click(function(){
		var gid = $('#gid').val();
		console.log(gid);
		$.ajax({
				url : '/login/checklogin',
				type : 'get',
				//这里使用json对象
				success : function(data){
					// console.log(data);
					if(data == 0){
						layer.msg('您还木有登录!', {
						  time: 0 //不自动关闭
						  ,btn: ['去登陆', '丑拒']
						  ,yes: function(index){
						    layer.close(index);
						    setTimeout(function(){
					        	location.href = '/login'
					        }, 300)
						  }
						});
					}else{
						// location.href = '/register'
						location.href = '/goods/buy/'+gid;
					}	
				}
		});
		
	});
</script>
@endsection

